import Vue from "vue";
import VueRouter from "vue-router";
Vue.use(VueRouter);

const routes = [
  //主页
  {
    path: "/",
    name: 'home',
    component: () => import("../components/home.vue"),
    meta: {
      keepAlive: true, //此组件不需要被缓存
    }
  },
  // 登录路由(有注册功能)
  {
    path: "/login",
    name: 'login',
    component: () => import("../components/login.vue"),
    meta: {
      keepAlive: false, //此组件不需要被缓存
    }
  },
  //购物车路由
  {
    path: "/cart",
    name: 'cart',
    component: () => import("../components/cart.vue"),
    meta: {
      keepAlive: true, //此组件不需要被缓存
    }
  },
  //个人页面路由
  {
    path: "/my",
    name: 'my',
    component: () => import("../components/my.vue"),
    meta: {
      keepAlive: true, //此组件不需要被缓存
    }
  },
  // 分类路由
  {
    path: "/classify",
    name: 'classify',
    component: () => import("../components/classify.vue"),
    meta: {
      keepAlive: true, //此组件不需要被缓存
    }
  },
  // 商品详情路由
  {
    path: "/shopping",
    name: 'shopping',
    component: () => import("../components/shopping.vue"),
    meta: {
      keepAlive: false, //此组件不需要被缓存
    }
  },
  // 个人信息界面路由
  {
    path: "/personal",
    name: 'personal',
    component: () => import("../components/personal.vue"),
    meta: {
      keepAlive: false, //此组件不需要被缓存
    }
  },
  //设置界面路由
  {
    path: "/settings",
    name: 'settings',
    component: () => import("../components/settings.vue"),
    meta: {
      keepAlive: false, //此组件不需要被缓存
    }
  },
  //地址界面路由
  {
    path: "/address",
    name: 'address',
    component: () => import("../components/address.vue"),
    meta: {
      keepAlive: false, //此组件不需要被缓存
    }
  },
  //修改地址界面路由
  {
    path: "/edit_address/:addressId",
    name: 'edit_address',
    component: () => import("../components/edit_address.vue"),
    meta: {
      keepAlive: false, //此组件不需要被缓存
    }
  },
  //订单路由
  {
    path: "/order/:sx",
    name: 'order',
    component: () => import("../components/order.vue"),
    meta: {
      keepAlive: false, //此组件不需要被缓存
    }
  },
  //购买路由
  {
    path: "/buy",
    name: 'buy',
    component: () => import("../components/buy.vue"),
    meta: {
      keepAlive: false, //此组件不需要被缓存
    }
  },
  //搜索路由
  {
    path: "/search",
    name: 'search',
    component: () => import("../components/search.vue"),
    meta: {
      keepAlive: false, //此组件不需要被缓存
    }
  },
  //评价界面
  {
    path: "/estimate/:order_id",
    name: 'estimate',
    component: () => import("../components/estimate.vue"),
    meta: {
      keepAlive: false, //此组件不需要被缓存
    }
  },
];
export default new VueRouter({
  routes,
});
